{% if page_obj.has_other_pages %}
<article>
  <ul class="actions pagination">
    {% if page_obj.has_previous %}
      <li><a class="button large next" href="?page=1">Первая</a></li>
      <li>
        <a class="button large next" href="?page={{ page_obj.previous_page_number }}">
          Предыдущая
        </a>
      </li>
    {% endif %}
    {% comment %} {% for i in page_obj.paginator.page_range %}
        {% if page_obj.number == i %}
          <li class="page-item active">
            <span class="disabled button large previous">{{ i }}</span>
          </li>
        {% else %}
          <li class="page-item">
            <a class="button large next" href="?page={{ i }}">{{ i }}</a>
          </li>
        {% endif %}
    {% endfor %} {% endcomment %}
    {% if page_obj.has_next %}
      <li class="page-item">
        <a class="button large next" href="?page={{ page_obj.next_page_number }}">
          Следующая
        </a>
      </li>
      <li class="page-item">
        <a class="button large next" href="?page={{ page_obj.paginator.num_pages }}">
          Последняя
        </a>
      </li>
    {% endif %}    
  </ul>
</article>
{% endif %}
